Skip to content

fix(workers): pass windowsHide to inner CLI spawns so no console window pops on Windows#256

Open
efenocchi wants to merge 5 commits into
mainfrom
fix/wiki-worker-windowshide
Open

fix(workers): pass windowsHide to inner CLI spawns so no console window pops on Windows#256
efenocchi wants to merge 5 commits into
mainfrom
fix/wiki-worker-windowshide

Conversation

@efenocchi

@efenocchi efenocchi commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

Users reported a bare claude.exe console window flashing up at session end on Windows.

The wiki worker and skillify gate worker are themselves spawned detached and console-less (spawn-detached.ts already sets windowsHide on the worker process). But the inner execFileSync that runs the summarizer CLI (claude -p / codex exec / cursor --print / pi --print / hermes -z) did not pass windowsHide, so Windows allocated a fresh visible console window titled after the CLI executable.

Fix

Add windowsHide: true (maps to CREATE_NO_WINDOW; a no-op on POSIX) to every inner CLI spawn:

  • both branches of buildClaudeInvocation / buildTrailingPromptInvocation in src/hooks/wiki-worker-spawn.ts (covers the claude/codex/cursor/pi wiki workers)
  • the hermes wiki worker's direct execFileSync (src/hooks/hermes/wiki-worker.ts)
  • the skillify gate-runner's CLI spawn (src/skillify/gate-runner.ts)

Tests

  • Unit assertions on every invocation-builder branch (tests/claude-code/wiki-worker-windows.test.ts)
  • Source-level guards for the hermes worker and the gate-runner — their dispatch tests exec a real binary and cannot observe the options object (tests/hermes/hermes-wiki-worker-source.test.ts, tests/claude-code/skillify-gate-runner.test.ts)
  • Full suite: tsc --noEmit clean, npm run build clean, 4415/4415 tests passing

Follow-up to #250, which fixed summary generation itself on Windows; this removes the remaining visible-console regression reported there.

Session Context

Session transcripts (investigation + PR creation)

Summary by CodeRabbit

  • Bug Fixes

    • Suppressed visible Windows console windows when spawning Hermes, agent/Claude helpers, and detached background workers, resulting in a cleaner, non-disruptive experience.
  • Tests

    • Added/expanded Vitest coverage to verify the Windows console suppression behavior across different invocation paths and platforms.

…ow pops on Windows

The wiki worker and skillify gate worker are spawned detached and
console-less (spawn-detached.ts already sets windowsHide on the worker
itself). But the INNER execFileSync that runs the summarizer CLI
(claude -p / codex exec / cursor --print / pi --print / hermes -z) did
not pass windowsHide, so Windows allocated a fresh visible console
window titled after the CLI exe — users reported a bare "claude.exe"
window appearing at session end.

Add windowsHide: true (CREATE_NO_WINDOW, no-op on POSIX) to:
- both branches of buildClaudeInvocation / buildTrailingPromptInvocation
  (covers the claude/codex/cursor/pi wiki workers)
- the hermes wiki worker's direct execFileSync
- the skillify gate-runner's CLI spawn

Tests: unit assertions on every builder branch, plus source-level
guards for the hermes worker and gate-runner (their dispatch tests exec
a real binary and cannot observe the options object).
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a6e51dea-cb02-4928-8bc9-07be8b2959f3

📥 Commits

Reviewing files that changed from the base of the PR and between 1aa65ef and e28681f.

📒 Files selected for processing (9)
  • src/commands/mine-local.ts
  • src/hooks/commit-kpi-extract.ts
  • src/hooks/hermes/wiki-worker.ts
  • src/hooks/wiki-worker-spawn.ts
  • src/skillify/advisor.ts
  • src/skillify/agent-model.ts
  • src/skillify/claude-model.ts
  • src/skillify/gate-runner.ts
  • src/skillify/stage-memory.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/skillify/gate-runner.ts
  • src/hooks/hermes/wiki-worker.ts

📝 Walkthrough

Walkthrough

Adds windowsHide: true to child-process options across Hermes, Claude invocation builders, skillify workers, and related spawn flows. Tests verify the option across platform and launcher branches.

Changes

Windows console suppression across worker spawns

Layer / File(s) Summary
Claude spawn-plan propagation
src/skillify/stage-memory.ts, src/hooks/wiki-worker-spawn.ts
Claude invocation options now carry windowsHide through planning into the final spawn call, while prompt builders set it across shell, non-shell, and stdin paths.
Worker and runner spawn updates
src/hooks/hermes/wiki-worker.ts, src/skillify/*, src/commands/mine-local.ts, src/hooks/commit-kpi-extract.ts
Child-process invocations for Hermes, gate-runner, mine-local, advisor, agent-model, Claude model, and KPI extraction now hide Windows console windows.
Spawn option regression coverage
tests/claude-code/*, tests/hermes/*
Vitest assertions cover Claude invocation branches, Hermes worker configuration, and gate-runner spawn options.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Suggested reviewers: kaghni, khustup2, khustup2

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding windowsHide to inner CLI spawns on Windows.
Description check ✅ Passed The description covers the problem, fix, tests, and follow-up context, though it does not use the repository's exact template headings.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wiki-worker-windowshide

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Scope: files changed in this PR. Enforced threshold: 90% per metric (per file via vitest.config.ts).

Status Category Percentage Covered / Total
🔴 Lines 89.16% (🎯 90%) 576 / 646
🔴 Statements 85.60% (🎯 90%) 636 / 743
🔴 Functions 81.30% (🎯 90%) 100 / 123
🔴 Branches 81.34% (🎯 90%) 388 / 477
File Coverage — 9 files changed
File Stmts Branches Functions Lines
src/commands/mine-local.ts 🟢 95.8% 🟢 92.5% 🟢 94.6% 🟢 98.0%
src/hooks/commit-kpi-extract.ts 🔴 0.0% 🔴 0.0% 🔴 0.0% 🔴 0.0%
src/hooks/hermes/wiki-worker.ts 🟢 98.6% 🟢 92.6% 🟢 100.0% 🟢 99.2%
src/hooks/wiki-worker-spawn.ts 🟢 100.0% 🟢 100.0% 🟢 100.0% 🟢 100.0%
src/skillify/advisor.ts 🔴 89.9% 🔴 89.1% 🔴 78.6% 🟢 95.5%
src/skillify/agent-model.ts 🟢 92.4% 🔴 89.8% 🔴 88.9% 🟢 100.0%
src/skillify/claude-model.ts 🔴 0.0% 🔴 0.0% 🔴 0.0% 🔴 0.0%
src/skillify/gate-runner.ts 🟢 96.4% 🔴 82.0% 🟢 100.0% 🟢 100.0%
src/skillify/stage-memory.ts 🟢 100.0% 🟢 94.7% 🟢 100.0% 🟢 100.0%

Generated for commit 6e98012.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/claude-code/skillify-gate-runner.test.ts`:
- Around line 12-13: The test currently only checks for the substring
"windowsHide: true" which can be false-positive; update the assertion to scope
the check to the actual spawn call by either (a) using a focused regex that
matches the call structure (e.g. a regex that finds execFileSync(...) or
runChildProcess(...) whose options object contains windowsHide:\s*true) or (b)
parsing the file with an AST parser (e.g. `@babel/parser`) and asserting that a
CallExpression with callee name execFileSync or runChildProcess has an options
ObjectExpression containing a Property with key "windowsHide" and value true;
replace the expect(src).toContain(...) with the scoped regex or AST-based
assertion so the test only passes when windowsHide is set inside the actual
spawn call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 086f8883-4f93-4e3b-b11f-cc945b42c2a7

📥 Commits

Reviewing files that changed from the base of the PR and between a54660f and 2549b25.

📒 Files selected for processing (6)
  • src/hooks/hermes/wiki-worker.ts
  • src/hooks/wiki-worker-spawn.ts
  • src/skillify/gate-runner.ts
  • tests/claude-code/skillify-gate-runner.test.ts
  • tests/claude-code/wiki-worker-windows.test.ts
  • tests/hermes/hermes-wiki-worker-source.test.ts

Comment thread tests/claude-code/skillify-gate-runner.test.ts Outdated
Substring toContain could false-positive if the token appeared anywhere
in the file. Tie the assertion to the runChildProcess / execFileSync
call structure ([^)]* = no closing paren between call open and the
option) per CodeRabbit review.
@efenocchi
efenocchi requested a review from khustup2 June 12, 2026 15:12
Resolve the tests/claude-code/skillify-gate-runner.test.ts conflict by
keeping main's new POSIX runGate-spawn suite and buildArgs import
alongside this branch's windowsHide source guard (merged the readFileSync
import into main's fs import list).

Re-apply windowsHide: true to the inner summarizer-CLI spawn sites that
main added after this PR was written, so a detached, console-less worker
never pops a visible console window on Windows (CREATE_NO_WINDOW; no-op on
POSIX):
- src/hooks/wiki-worker-spawn.ts buildStdinPromptInvocation (doc
  refresh/generate path, execFileSync'd by refresh-llm.ts runHostPrompt)
- src/skillify/stage-memory.ts (threaded through planClaudeSpawn into the
  spawn call)
- src/skillify/advisor.ts (mine-local advisor gate claude spawn)
- src/skillify/claude-model.ts (skillopt judge/proposer claude spawn)
- src/commands/mine-local.ts (mine-local summarizer claude -p spawn)
- src/hooks/commit-kpi-extract.ts (detached claude/codex kpi spawn)

The claude/codex/cursor/pi wiki-workers and the hermes worker + gate-runner
already inherit windowsHide from the merged builders / their own patched
spawns.
Assert buildStdinPromptInvocation / buildClaudeStdinInvocation (main's
doc refresh/generate builders) carry windowsHide on both the .cmd shell
branch and the .exe/Unix branch — the same unit-level guard the other
two builders already have.

Add source-level guards (tests/claude-code/inner-cli-spawn-windowshide-source.test.ts)
for the spawn sites that exec a real summarizer binary and so cannot
observe the options object in a unit test: mine-local, advisor,
claude-model, commit-kpi-extract, and stage-memory's plan threading.
Each regex is scoped to the specific spawn/exec call so it fails if the
option drifts out of that spawn.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants